package com.topdt.jbpm.utils;

import com.topdt.jbpm.form.FormMenuDefin;
import com.topdt.jbpm.model.Application;
import com.topdt.jbpm.model.Control;

public class ControlUtils {
	public static boolean getReadValue(Object arg){
		char flag = ((String)arg).charAt(0);
		if(flag=='R'){
			return true;
		}
		return false;
	}
	
	public static boolean getShowValue(Object arg){
		char flag = ((String)arg).charAt(0);
		if(flag=='N'){
			return false;
		}
		return true;
	}
	public static boolean getFunValue(Object arg){
		char flag = ((String)arg).charAt(0);
		if(flag=='0'){
			return false;
		}
		return true;
	}
	public static boolean IsOption(Control control){
		String functionControl = control.getFunctionControl();
		String[][] sArray = FormMenuDefin.getMenuItems(Application.APPATTR_FORM);
		int index = 0;
		for(int i = 0 ; i<sArray.length; i++){
			if("opinion".equals(sArray[i][0])){
				index = i;
			}
		}
		char flag = functionControl.charAt(index);
		if(flag=='0'){
			return false;
		}
		return true;
	}
}
